<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1" import="Reservation.*,Application.Dao.*,DomainData.*,java.util.List"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link href="css/general.css" rel="stylesheet" type="text/css" />
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.6.2.min.js" type="text/javascript"
	charset="utf-8"></script>

<script type="text/javascript">
function addMainCourse(name){
	alert(name);
	table= document.getElementById("getElementById").getElementsByTagName("TBODY")[0];;
	 var row = document.createElement("TR");
    var td1 = document.createElement("TD");
    td1.appendChild(document.createTextNode(name));

    row.appendChild(td1);

    tbody.appendChild(row);
}
	
	


</script>	
	
	
</head>
<%
	String rid=request.getParameter("rid");
	int rID;
	if(rid!=null&&!rid.equals(""))
	{
		rID= rID=Integer.parseInt(rid);
		System.out.println("Rid is:"+rID);
	}
	System.out.println("Prompt for rid");
	
/* int rID=Integer.parseInt(request.getParameter("rid"));
String orderlist=OrderDAO.getorderList(rID);
String[] contentList = orderlist.split(",");
for(int i=1; i<=4;i+=4){
	out.println("<tr>"
			+"<td width='22%' height='110'><img src='images/"+contentList[i]+"' "
			+	"alt='small product photo' width='110' height='110' border='0' /></td><td>&nbsp;</td>"
			+"<td width='22%' height='110'><img src='images/2.jpg' alt='small product photo' width='110' height='110' border='0' /> </td>"+
			"<td>&nbsp;</td> <td width='22%' height='110'><img src='images/3.jpg' alt='small product photo' width='110' height='110' border='0' /></td>"+
			"<td>&nbsp;</td><td width='22%' height='110'><img src='images/4.jpg' alt='small product photo' width='110' height='110' border='0' /></td>"+
		"</tr>");
} */
%>
<body>
	<div class="mainBackground"></div>
	<div id="maincontent" class="center">
		<p>&nbsp;</p>
		<h2>Select entries from the menu</h2>
<table>
	<tr>	<td><table id="main_course_table" width="100%" border="0" cellspacing="0" cellpadding="0" border="1">

			<tr bgcolor="#FFFFCC">
				<td width="15" nowrap="nowrap">&nbsp;</td>
				<td height="36" colspan="2" id="navigation" nowrap="nowrap"
					class="navText">
				</td>
				<td>&nbsp;</td>
			</tr>

			<tr bgcolor="#ffffff">
				<td width="15" valign="top"><img src="mm_spacer.gif" alt=""
					width="15" height="1" border="0" />
				</td>
				<td width="35" valign="top"><img src="mm_spacer.gif" alt=""
					width="35" height="1" border="0" />
				</td>
				<td width="701" valign="top"><br />
					<table border="0" cellspacing="0" cellpadding="2" width="700">
				
				<%
					
					List<MainCourse> list = MainCourseDAO.getAllMainCourses();
					for(int i=0; i<20;i+=4){
						MainCourse mc1=list.get(i);
						MainCourse mc2=list.get(i+1);
						MainCourse mc3=list.get(i+2);
						MainCourse mc4=list.get(i+3);
						out.println("<tr>"
								+"<td width='22%' height='110'><img src='images/"+mc1.getID()+".jpg' "
								+	"alt='small product photo' width='110' height='110' border='0' /></td><td>&nbsp;</td>"
								+"<td width='22%' height='110'><img src='images/"+mc2.getID()+".jpg' alt='small product photo' width='110' height='110' border='0' /> </td>"+
								"<td>&nbsp;</td> <td width='22%' height='110'><img src='images/"+mc3.getID()+".jpg' alt='small product photo' width='110' height='110' border='0' /></td>"+
								"<td>&nbsp;</td><td width='22%' height='110'><img src='images/"+mc4.getID()+".jpg' alt='small product photo' width='110' height='110' border='0' /></td>"+
							"</tr>");
						
						out.println("<tr><td valign='top' class='bodyText' nowrap='nowrap'><a id='"+mc1.getCourseName()+"' onclick='addMainCourse(&quot;"+mc1.getCourseName()+"&quot;)'> "+mc1.getCourseName()+" </a><br /> Price: $"+mc1.getCoursePrice()+"</td><td>&nbsp;</td>"
								+"<td valign='top' class='bodyText' nowrap='nowrap'><a href=''>"+mc1.getCourseName()+" </a><br /> Price: $"+mc2.getCoursePrice()+"</td><td>&nbsp;</td>"
								+"<td valign='top' class='bodyText' nowrap='nowrap'><a href='javascript:;'>"+mc1.getCourseName()+" </a><br /> Price: $"+mc3.getCoursePrice()+"</td><td>&nbsp;</td>"
							+"<td valign='top' class='bodyText' nowrap='nowrap'><a href='javascript:;'>"+mc1.getCourseName()+" </a><br /> Price: $"+mc4.getCoursePrice()+"</td>");
					
						out.println("</tr><tr><td colspan='7'>&nbsp;</td></tr>");
					} 
						
				%>
					</tr><tr><td colspan='7'>&nbsp;</td></tr>	
						
					</table></td>
				<td>&nbsp;</td>
			</tr>

			<tr>
				<td width="15">&nbsp;</td>
				<td width="35">&nbsp;</td>
				<td width="701">&nbsp;</td>
				<td width="275">&nbsp;</td>
			</tr>
		</table>
	</td>
<td vertical-align="top" border="0">
	<table id="order_list_table" width="200" border="0">
      <tr>
        <td bgcolor="#FFF99" border="1">Order List</td>
      </tr>
      <tr>
        <td><div align="center">huiguorou</div></td>
      </tr>
      <tr>
        <td><div align="center">shuizhuniu</div></td>
      </tr>
      <tr>
        <td><div align="center">mapodoufu</div></td>
      </tr>
    </table></td> </tr>

	</div>
	<div class="clear"></div>
<table>
	<div id="footer">
		&copy; K&G Restaurant | all Rights Reserved by CSE 333 <span
			class="credit"><a
			href="http://www.weibo.com/gaotaojie/profile?topnav=1&wvr=4">Taojie
				Gao's Paradise</a> by Taojie Gao</span>

	</div>

</body>
</html>